/**
 * Return an array of arrays of size *returnSize.
 * The sizes of the arrays are returned as *returnColumnSizes array.
 * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
 */
int** transpose(int** matrix, int matrixSize, int* matrixColSize, int* returnSize, int** returnColumnSizes) {
    //row mc[0] rc; col m r;
    int row = matrixColSize[0], col = matrixSize;
    int **ans = malloc(sizeof(int*) * row);
    *returnSize = row;
    *returnColumnSizes = malloc(sizeof(int) * row);
    for(int i = 0; i < row; i++){
        ans[i] = malloc(sizeof(int) * col);
        (*returnColumnSizes)[i] = col;
    }
    for(int i = 0; i < col; i++){
        for(int j = 0; j < row; j++){
            ans[j][i] = matrix[i][j];
        }
    }
    return ans;
}